#ifndef RTAPI_FIRMWARE_H
#define RTAPI_FIRMWARE_H

#ifdef __KERNEL__
#include <linux/firmware.h>

// types
#define rtapi_firmware firmware
#ifndef rtapi_device  // could be defined in first-included rtapi_device.h
#define rtapi_device device
#endif

// functions
#define rtapi_request_firmware request_firmware
#define rtapi_release_firmware release_firmware

#else
#include <rtapi.h>

RTAPI_BEGIN_DECLS

#include <rtapi_stdint.h>
#include <stddef.h>

struct rtapi_device;
struct rtapi_firmware
{
    size_t size;
    const rtapi_u8* data;
};

extern int rtapi_request_firmware(const struct rtapi_firmware** fw, const char* name, struct rtapi_device* device);

extern void rtapi_release_firmware(const struct rtapi_firmware* fw);

RTAPI_END_DECLS

#endif
#endif
